package com.mcxx.modules.miniSalvation.order.service.write;



import com.mcxx.modules.miniSalvation.order.dao.write.BlacklistWriteDao;
import com.mcxx.modules.miniSalvation.order.entity.BlacklistEntity;
import com.yinhai.ta404.core.security.vo.UserAccountVo;
import com.yinhai.ta404.core.transaction.annotation.TaTransactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDate;
import java.util.List;


@Service
@TaTransactional
public class BlacklistWriteService {

    @Autowired
    private BlacklistWriteDao blacklistWriteDao;



    public int insert(BlacklistEntity blacklist) {
    	return blacklistWriteDao.insert(blacklist);
    }


    public int insertIgnoreNull(BlacklistEntity blacklist) {
    	return blacklistWriteDao.insertIgnoreNull(blacklist);
    }


    public int update(BlacklistEntity blacklist) {
    	return blacklistWriteDao.update(blacklist);
    }


    public int updateIgnoreNull(BlacklistEntity blacklist) {
    	return blacklistWriteDao.updateIgnoreNull(blacklist);
    }


    public int delete(BlacklistEntity blacklist) {
    	return blacklistWriteDao.delete(blacklist);
    }


    public int bachInsert(List<BlacklistEntity> blacklistEntities) {
        return  blacklistWriteDao.batchInsert(blacklistEntities);
    }



    public int deleteByIds(String ids, UserAccountVo userAccountVo) {
        String releaseOperator=userAccountVo.getUsername();
        String releaseDate=String.valueOf(LocalDate.now());
        return  blacklistWriteDao.deleteByIds(releaseOperator,releaseDate,ids.split(","));
    }
}
